Skip to content

fix(android): keep callbacks on non-public base classes from R8 - #8657

Merged
ItsChaceD merged 6 commits into
mainfrom
fix/RMET-5521/android-r8-core-rules-cap8
Oct 23, 2026
Merged

ItsChaceD merged 6 commits into
mainfrom
fix/RMET-5521/android-r8-core-rules-cap8

Conversation

@ItsChaceD

@ItsChaceD ItsChaceD commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a keep rule to core's proguard-rules.pro for @ActivityCallback and @PermissionCallback methods on any Plugin subclass. #8646 keeps the annotation types, but R8 still drops these callbacks when they're declared on a non-public base class.

Tested on 8.5.3 with R8 on and proguard-android-optimize.txt. With #8646 alone, an @ActivityCallback on a package-private base class fails with "There is no ActivityCallback method registered". With this rule it resolves as with R8 off.

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation
  • Other (CI, chores, etc.)

Rationale / Problems Fixed

https://outsystemsrd.atlassian.net/browse/RMET-5521

Platforms Affected

  • Android
  • iOS
  • Web

Notes

The Room and Firebase rules from the first version now ship in the plugins that need them, per review. Capacitor 9 gets the same rule in #8658.

@OS-pedrogustavobilro OS-pedrogustavobilro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Capacitor apps on AGP 8 and 9 with multiple plugins (including ones with permissions and activity callbacks), no crashes, all is working. Nice!

I'm leaving a non-blocker comment but approving the PR.

Comment thread android/capacitor/proguard-rules.pro Outdated
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Oct 16, 2026
@ItsChaceD ItsChaceD changed the title fix(android): add R8 keep rules for callbacks and AGP 9 fix(android): keep callbacks on non-public base classes from R8 Oct 21, 2026
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Oct 22, 2026
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Oct 23, 2026
@ItsChaceD
ItsChaceD merged commit 02e43f8 into main Oct 23, 2026
6 checks passed
@ItsChaceD
ItsChaceD deleted the fix/RMET-5521/android-r8-core-rules-cap8 branch October 23, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants